//山脉数组的峰顶索引
//测试链接 https://leetcode.cn/problems/peak-index-in-a-mountain-array/description/
public class PeakIndexInMountainArray {
    public int peakIndexInMountainArray(int[] arr) {
        int left = 1, right = arr.length-2; //左右点个点一定不是山峰

        while(left < right){
            int mid = left + (right - left +1) / 2;
            if(arr[mid] > arr[mid-1]){
                left = mid;
            }else {
                right = mid - 1;
            }
        }

        return left;
    }
}
